from tortoise import fields
from .base import BaseModel, TimestampMixin

class Detection(BaseModel, TimestampMixin):
    """检测记录"""
    rotor_type = fields.ForeignKeyField('models.RotorType', related_name='detections')
    detection_type = fields.IntField(description="检测类型: 0-平稳性检测,1-俯仰检测,2-偏航检测,3-横滚检测")
    operator = fields.ForeignKeyField('models.User', related_name='detections')
    detection_time = fields.DatetimeField(description="检测时间", auto_now_add=True)
    duration = fields.IntField(null=True, description="检测时长(秒)")
    image_path = fields.CharField(max_length=500, null=True, description="图片存储路径")
    video_path = fields.CharField(max_length=500, null=True, description="视频存储路径")
    status = fields.IntField(default=0, description="状态: 0-进行中,1-已完成")

    class Meta:
        table = "detection"
        table_description = "检测记录表" 